package com.yugao.fintech.draper.auth.api;

import com.yugao.fintech.draper.auth.dto.SocialUserDTO;
import com.yugao.fintech.draper.auth.dto.UserInfoVO;
import com.yugao.fintech.draper.common.constant.ServerConstant;
import com.yugao.fintech.draper.core.constant.SecurityConstants;
import com.yugao.fintech.draper.core.model.ResultVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(contextId = "socialFeignApi", value = ServerConstant.DRAPER_ADMIN)
public interface SocialFeignApi {

	/**
	 * 添加
	 */
	@PostMapping(value = "/gitee/add", headers = SecurityConstants.HEADER_INNER)
	ResultVO<Boolean> add(@RequestBody SocialUserDTO socialUserDTO);

	/**
	 * 绑定用户
	 */
	@PostMapping(value = "/gitee/binding", headers = SecurityConstants.HEADER_INNER)
	public ResultVO<Boolean> binding(@RequestBody SocialUserDTO socialUserDTO);

	/**
	 * 根据appid、id查询
	 */
	@GetMapping(value = "/gitee/getByAppidAndId", headers = SecurityConstants.HEADER_INNER)
    ResultVO<SocialUserDTO> getByAppidAndId(@RequestParam("appId") String appId, @RequestParam("id") Integer id);

	/**
	 * 获取绑定的用户信息
	 */
	@GetMapping(value = "/gitee/getUser", headers = SecurityConstants.HEADER_INNER)
    ResultVO<UserInfoVO> getUser(@RequestParam("appId") String appId, @RequestParam("id") Integer id);

	/**
	 * 更新
	 */
	@PostMapping(value = "/gitee/update", headers = SecurityConstants.HEADER_INNER)
    ResultVO<Boolean> update(@RequestBody SocialUserDTO socialUserDTO);

}
